import { Controller, Post } from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { UseInterceptors, UploadedFile } from '@nestjs/common';
import { ApiConsumes, ApiImplicitFile } from '@nestjs/swagger';

@Controller('api')
export class FileController {
  @Post('uploadFile')
  @ApiConsumes('multipart/form-data')
  @ApiImplicitFile({ name: 'file', required: true, description: 'List of cats' })
  @UseInterceptors(FileInterceptor('file'))
  getImage(@UploadedFile() file) {
    return file.fieldname;
  }
}
